<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta property="wb:webmaster" content="239d3d1dbdde1b2c" />
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" href="css/common.css" />

<link rel="stylesheet" href="css/login.css" />

<!--[if lt IE 9]><link rel="stylesheet" type="text/css" href="css/frontPage-ie8-fix.css" /><![endif]-->
<!--[if lte IE 10]><script>document.createElement('footer');document.createElement('header');document.createElement('nav');document.createElement('section');document.createElement('article');</script><![endif]-->
<!--[if lte IE 7]><script>window.onload=function(){location.href="/ie6warning/"}</script><![endif]-->
<title>注册</title>
<script type="text/javascript">
	(function(document, screen) {
		if (screen.width < 760) {
			document.location.href = "/mobile/";
		}
	}(document, screen));
</script>
</head>
<body>

	<header id="header" class="">
	<div class="common-width">

		<section class="clearfix">
		<h1 class="logo" title="即刻平台">
			<a href="index.html">1</a>
		</h1>
		<span class="page-name"> 即刻  | 注册</span> </section>


	</div>
	</header>

	<section class="main">
	<div class="common-width">

		<div class="main-inner">

			<div class="log-box" id="registerPageBox">
				<div class="form-group w275">
					<label for="">手机号码</label> <input type="text" id="phoneNumber"
						maxlength="11" class="form-text" placeholder="请输入你的手机号码" />
				</div>
				<div class="form-error-message"></div>
				<div class="captcha-wrap">
					<div class="captcha-box" id="captchaBox"
						style="margin-left: -300px">
						<div class="captcha-item">
							<div class="form-group captcha clearfix">
								<input type="text" id="rCaptcha" class="form-text"
									placeholder="短信验证码" /> <input type="button" id="getCaptcha"
									class="captcha-btn" value="获取验证码" />
							</div>
							<div class="form-error-message"></div>
						</div>
						<div class="captcha-item">
							<div class="form-group captcha clearfix">
								<input type="text" id="code" 
									maxlength="" class="form-text" placeholder="输入验证码" /> <input
									type="hidden" name="code2" id="code2" />
								<button id="send" type="button">点击发送验证码</button>
							</div>
							<div class="form-error-message"></div>
						</div>
					</div>
				</div>
				
				<div class="form-error-message"></div>
				<div>
					<button class="form-btn" id="register">确认注册</button>
				</div>
			</div>
		</div>
	</div>
	</section>
	<footer id="footer">
	
	
	</footer>
	
	<script src="js/jquery.min.js"></script>
	<script src="js/angular.min.js"></script>
	<script src="js/jquery.validate.min.js?var1.14.0"></script>
	
	<script src="js/common.js"></script>
	<script type="text/javascript" src="layui/layui.js">
	
	</script>
	<script>
		// use new sms code url
		var ajax_customer_user_register_start = '/ajax/customer_user_register_start/';
		var common_sms_code = '/ajax/common_sms_code/';
		var common_validate_sms_code = '/ajax/common_validate_sms_code/';
		var ajax_customer_user_register_register = '/ajax/customer_user_register_register/';
	</script>
	

	<!-- Baidu Analytics -->

	<!-- End Baidu Tracking Code -->

	<!-- Baidu Remarketing code -->
	<script type="text/javascript">
	<!--
		(function(d) {
			window.bd_cpro_rtid = "rHDzrHT";
			var s = d.createElement("script");
			s.type = "text/javascript";
			s.async = true;
			s.src = location.protocol + "//cpro.baidu.com/cpro/ui/rt.js";
			var s0 = d.getElementsByTagName("script")[0];
			s0.parentNode.insertBefore(s, s0);
		})(document);
	//-->
	</script>
	<!-- End Baidu Remarketing code -->

	<!-- Google Analytics Code -->
	<script>
		(function(i, s, o, g, r, a, m) {
			i['GoogleAnalyticsObject'] = r;
			i[r] = i[r] || function() {
				(i[r].q = i[r].q || []).push(arguments)
			}, i[r].l = 1 * new Date();
			a = s.createElement(o), m = s.getElementsByTagName(o)[0];
			a.async = 1;
			a.src = g;
			m.parentNode.insertBefore(a, m)
		})(window, document, 'script',
				'//www.google-analytics.com/analytics.js', 'ga');

		ga('create', 'UA-33138478-1', 'waimaichaoren.com');
		ga('send', 'pageview');
		ga('require', 'ecommerce', 'ecommerce.js');
	</script>
	
	
	
	


<script type="text/javascript">

	 $(function(){
		 //弹出层的使用
		 layui.use('layer', function() {
				var layer = layui.layer;

			});
		var phoneNumber="";//初始化电话号码
		var code="";//初始化验证码
		var msg="";//验证提示信息
		var flag=false;
		var phoneTest=/(^1[3|5|8|7][0-9]{9}$)/; //手机号正则表达式，规定由全为数字，1开头				
		//点击发送验证码事件触发	，获得验证码，储存在文本隐藏域
	 $("#send").click(function(){
		 var phoneNumber=$("#phoneNumber").val();
		 if(phoneTest.test(phoneNumber)){
			 $(this).attr("disabled","disabled");//将按钮设为不可点击 
			 msg="验证码已发送至手机，30s后可重新发送";
			 layer.msg('<span style="color:black;">'+msg+'</span>', {
					icon:6,
					time: 2000
				}); 			 
			  //ajax传到服务层，发送手机验证码
		    $.get("/JIKE/user.action","op=sendCode&phoneNumber="+phoneNumber,function(data,status){
				
				$("#code2").val(data);//把发送的验证码储存在隐藏域里，方便之后进行注册验证												
			}); 
		    			 
		 }
		 else{
			 msg="请输入正确手机号码";
			 layer.msg('<span style="color:black;">'+msg+'</span>', {
					icon:5,
					time: 2000
				}); 
			 $(this).val("");
			 
		 }			
	 })	 ;
		$("#code").change(function(){
			if($(this).val()!=$("#code2").val()){
				msg="验证码输入错误";
				layer.msg('<span style="color:black;">'+msg+'</span>', {
					icon:5,
					time: 2000
				}); 
				$(this).val("");
				
			}
			else{
			  flag=true;	
			}
		});
		
		//注册按钮点击事件
		$("#register").click(function(){			
			 phoneNumber=$("#phoneNumber").val();
			 code=$("#code").val();			 
			 //如果输入框存在空值，则弹窗提醒
			if(flag==false || (phoneNumber !="" && code !="")==false){
				msg="验证码输入错误";
				layer.msg('<span style="color:black;">'+msg+'</span>', {
					icon:4,
					time: 2000
				});
			} 
			else{
				var storeTel = $("#phoneNumber").val();
				console.log(storeTel);
	                $.ajax({
						//请求类型
						type : 'get',
						//请求的地址,@RequestMapping的值
						url : 'sellerLogin/'+storeTel,
						//从服务器[控制器]一侧返回的数据类型
						dataType : 'json',
						//完整的代码，是三个参数，第一个参数result是返回鹅结果
						// 第二个参数是状态
						//第三个对象 xmlHttpRequest对象
						success : function(result, status, xhr) {
							if(result){
								location.href="food/list";
								}else{

											location.href="www.xinlang.com";

								}
						}
					});
			//else	
			}
			
			
		});
	 
	 
	
	 });
 
</script>

	<!-- End Google Analytics Code -->

</body>
</html>